package org.example.day02;

/**
 * 第一章节1.8.2.2:suspend和resume方法的缺点
 */
public class MyThread2 extends Thread{
    private long i = 0;
    @Override
    public void run() {
        while(true){
            i++;
            System.out.println(i);
        }
    }

    public static void main(String[] args) {
        try {
            MyThread2 m2 = new MyThread2();
            m2.start();
            Thread.sleep(1000);
            m2.suspend();
            System.out.println("main end");
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }
}
